package interfaces.superWidgets.tabs;

import interfaces.superWidgets.InterfaceButton;

import java.util.ArrayList;
import java.util.List;

public class HorizontalTabContent extends AbsTabContent {
	
	private List<InterfaceButton> tabButtons;
	
	public HorizontalTabContent(int width, int height) {
		super(width, height);
		
		tabButtons = new ArrayList<InterfaceButton>();
	}
	
	@Override
	public void addTabButton(InterfaceButton button) {
		super.addTabButton(button);
		tabButtons.add(button);
		button.setHeight(height);
		button.setY(0);
		
		int newWidth = width / tabButtons.size();
		int newX = 0;
		for(InterfaceButton b : tabButtons) {
			b.setWidth(newWidth);
			b.setX(newX);
			newX += newWidth;
		}
		layout();
	}
	
	public List<InterfaceButton> getTabButtons() { return tabButtons; }
}